package com.twu.biblioteca;

public class UserAccount {

    private String userLogin;
    private String userPassword;
    private UserInformation userInfo;

    public UserAccount(String username, String password, UserInformation userInformation) {
        userLogin = username;
        userPassword = password;
        userInfo = userInformation;
    }

    public boolean login(String username, String password) {
        if(userLogin.equals(username) &&
                userPassword.equals(password))
            return true;
        return  false;
    }

    public UserInformation getUserInformation() {
        return userInfo;
    }

    @Override
    public boolean equals(Object objectToCompare){
        if(!(objectToCompare instanceof UserAccount))
            return false;

        UserAccount accountToCompare = (UserAccount) objectToCompare;
        if (userInfo.equals(accountToCompare.getUserInformation()) && accountToCompare.login(userLogin,userPassword))
            return true;

        return false;
    }


}
